package com.cskaoyan.shopping.service.zyl_homepage_and_anvigation;

import com.cskaoyan.shopping.dal.entitys.Panel;
import com.cskaoyan.shopping.dal.entitys.PanelContent;
import com.cskaoyan.shopping.dal.entitys.PanelContentItem;
import com.cskaoyan.shopping.dal.persistence.PanelContentMapper;
import com.cskaoyan.shopping.dal.persistence.PanelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PanelServiceImpl implements PanelService{

    @Autowired
    PanelMapper panelMapper;

    @Autowired
    PanelContentMapper panelContentMapper;
    @Override
    public List<Panel> selevt_Panel() {
        return  panelMapper.selectAll();
    }

    @Override
    public List<PanelContent> selevt_Content(Integer panel_id) {
        PanelContent panelContent = new PanelContent();
        panelContent.setPanelId(panel_id);
        return panelContentMapper.select(panelContent);
    }

    @Override
    public List<PanelContentItem> selectPanelContentAndProductWithPanelId(Integer panelId) {
        return  panelContentMapper.selectPanelContentAndProductWithPanelId(panelId);
    }

    @Override
    public List<PanelContent> selectPanelContents(Integer panelId) {
        PanelContent panelContent = new PanelContent();
        panelContent.setPanelId(panelId);
        return panelContentMapper.select(panelContent);
    }
}
